{extend name="public:public" /}
{block name="section"}
	<link href="__ADMIN__/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<div class="page-container" style="margin-left: 200px">
	<form action="" method="post" class="form form-horizontal" id="form-article-edi" enctype="multipart/form-data" onsubmit="return doSubmit()">
        <input type="hidden" name="id" value="{$info.id}" />
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>店铺名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$info.name}" placeholder="请输入店铺名称..."  name="name">
			</div>
		</div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>店铺位置：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$info.address}" placeholder="请输入店铺位置..."  name="address">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>营业时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$info.job_time}" placeholder="请输入店铺位置..."  name="job_time">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系电话：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$info.phone}" placeholder="请输入店铺位置..."  name="phone">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公告：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="notice" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)">{$info.notice}</textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
            </div>
        </div>

        {notempty name="$info.img"}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">原店铺头像：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <img src="{$info.img}" style="width: 200px">
            </div>
        </div>
        {/notempty}

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">店铺头像：</label>
            <div class="formControls col-xs-6 col-sm-6"> <span class="btn-upload form-group">
                <input class="input-text upload-url" type="text" name="uploadfile" id="uploadfile" readonly nullmsg="请添加附件！" style="width:200px">
                <a href="javascript:void(0);" class="btn btn-primary radius upload-btn"><i class="Hui-iconfont">&#xe642;</i> 浏览文件</a>
                <input type="file"  name="img" class="input-file">
                </span>
            </div>
        </div>


		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">详细内容：</label>
			<div class="formControls col-xs-8 col-sm-9"><script id="editor" name="content" type="text/plain" style="width:375px;height:800px;">{$info.content}</script></div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
             </div>
        </div>
    </form>
</div>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/jquery.validate.js"></script><script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="__ADMIN__/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>


<script type="text/javascript">
    $('#menu-system').children('dt').addClass('selected');
    $('#menu-system').children('dd').show();
    $('#menu-system').children('dd').find('a').eq(1).css({
        color:'#148cf1',
        backgroundColor:'#FFF'
    });


    function doSubmit(){
        var form = document.getElementById('form-article-edi');
        var formData = new FormData(form);
        $.ajax({
            type : 'POST',
            url : "{:url('admin/ShopInfo/index')}",
            data : formData,
            dataType : 'json',
            processData : false,
            contentType : false,
            success:function(data){
                if(data.error == 0){
                    layer.msg(data.msg,{icon:6});
                    setTimeout("parent.location.reload();",1000);
                }else if(data.error == 1){
                    layer.msg(data.msg,{icon:5});
                }
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){

            },
        });
        return false;
    }
//    $("#form-article-edi").validate({
//        rules:{
//            name:{
//                required:true,
//            },
//            address:{
//                required:true,
//            },
//            job_time:{
//                required:true,
//            },
//            phone:{
//                required:true,
//            },
//            notice:{
//                required:true,
//            },
//            content:{
//                required:true,
//            },
//        },
//        onkeyup:false,
//        focusCleanup:true,
//        success:"valid",
//        submitHandler:function(form){
//            $(form).ajaxSubmit({
//                type: 'post',
//                url: "index" ,
//                success: function(data){
//                    layer.msg(data.msg,{icon:data.icon,time:1000},function () {
//                    });
//                },
//                error: function(XmlHttpRequest, textStatus, errorThrown){
//                    layer.msg('服务器错误!',{icon:2,time:1000});
//                    window.parent.location.reload();
//                }
//            });
//        }
//    });

    $(function(){
        var ue = UE.getEditor('editor');
    });



</script>
{/block}
